package day04;
//switch...case

import java.util.Random;
import java.util.Scanner;

public class CommandBySwitch {
    public static void main(String[] args) {

/*
        Random rd=new Random();
        int a=rd.nextInt(10);
        int a1=rd.nextInt(10);
        int a2=rd.nextInt(10);
        int a3=rd.nextInt(10);
        String a4=""+a+a1+a2+a3;
        System.out.println("验证码为:"+a4);

        System.out.println("请输入command的值");
        Scanner sc=new Scanner(System.in);
        String command =sc.nextLine();
        System.out.println("command的值为:"+command);

        if (command.equals(a4)){
            System.out.println("验证码正确");
        }else {
            System.out.println("验证码错误");
        }

 */

        Scanner sc=new Scanner(System.in);//创建一个新的扫描器
        System.out.println("请选择功能:1.存款 2.取款 3.查询余额 4.退卡");
        int command =sc.nextInt();//输入一个数字到控制台中


        if(command>0 && command<4){
        }
            switch (command) {//若输入的数字与case的值相同,则执行case的语句
                case 1:
                    System.out.println("存款");
                    break;
                case 2:
                    System.out.println("取款");
                    break;
                case 3:
                    System.out.println("查询余额");
                    break;
                case 4:
                    System.out.println("退卡");
                    break;
            }




        /*

            switch (command) {//若输入的数字与case的值相同,则执行case的语句
                case 1:
                    System.out.println("存款");
                    break;
                case 2:
                    System.out.println("取款");
                    break;
                case 3:
                    System.out.println("查询余额");
                    break;
                case 4:
                    System.out.println("退卡");
                    break;
                default:
                    System.out.println("输出错误");
            }
         */

    }
}
